import PageWrapper from "@/components/PageWrapper";
import styles from "./question.module.scss";
import Router from "next/router";
import { Button } from "antd";

export default function Fail(reqBody: any = {}) {
  const { message } = reqBody;

  return (
    <PageWrapper title="失败">
      <div style={{ marginTop: "50%", textAlign: "center" }}>
        <h2>失败</h2>
        <p>{message}</p>
        <div className={styles["button-wrapper"]}>
          <Button type="primary" onClick={() => Router.back()}>
            返回
          </Button>
        </div>
      </div>
    </PageWrapper>
  );
}

export async function getServerSideProps(context: any) {
  const { message } = context.query;

  return {
    props: { message },
  };
}
